package com.ytjj.qmyx.mall.utils;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ytjj.qmyx.mall.model.dto.ExpressDto;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description TODO
 * @ClassName FakeExpressUtil
 *
 * 
 * @Version 1.0
 **/

public class FakeExpressUtil {

    public static JSONArray getFakeExpress() {
        JSONArray expressArray = new JSONArray();
        ExpressDto expressDto = new ExpressDto();
        expressDto.setContext("商品已经下单");
        expressDto.setFtime(dateToStr(new Date()));
        expressDto.setTime(dateToStr(new Date()));
        expressDto.setDeliveryStatus("已下单");
        expressDto.setStatus(10);
        expressArray.add(expressDto);
        ExpressDto expressDto2 = new ExpressDto();
        expressDto2.setContext("您已成功下单，请等待商家系统确认");
        expressDto2.setFtime(dateToStr(new Date()));
        expressDto2.setTime(dateToStr(new Date()));
        expressDto2.setDeliveryStatus("等待确认");
        expressDto2.setStatus(11);
        expressArray.add(expressDto2);
        return expressArray;
    }

    public static String dateToStr(Date date) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str = format.format(date);
        return str;
    }

    public static void main(String[] args) {
        System.out.println(JSONObject.toJSONString(getFakeExpress(), true));
    }

}
